package springcloud.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("customer")
public class OrderController {

    @Resource
    private RestTemplate restTemplate;

    public static final String PAYENT_URL = "http://consul-payment-service";

    @GetMapping("payment/consul")
    public String getPaymentInfo() {
        return restTemplate.getForObject(PAYENT_URL + "/payment/consul", String.class);
    }
}
